Machine vision systems are used widely in industry for accomplishing automated visual inspection of many different types of articles. A typical machine vision system comprises a television camera, which carries a lens or a similar optical system, and a machine vision processor, (e.g., a microprocessor) for processing the output signal of the camera. In practice, the vision processor is programmed to examine certain attributes of the image of the article captured by the camera in order to detect a defect, such as the presence or absence of a particular feature.
To achieve high accuracy with present day machine vision systems, it is important that the image of the article captured by the camera be in sharp focus. The more sharply focused the image of the article, the higher the degree of contrast and the greater the accuracy of inspection. For those applications where the articles undergoing inspection are all the same type, it is usually only necessary to manually adjust the focus of the camera at the outset of inspection, either by adjusting the lens or the spacing between the camera and the article, in order to assure that the image of each article is sharply focused. However, if different articles are being inspected by the same machine vision system, it is often necessary to adjust the focus of the camera each time an article different from the previous one is undergoing inspection. To avoid the need for an operator to manually adjust the camera focus, autofocusing systems have been developed.
Present day autofocusing systems typically include a motor which drives either a focusing element on the lens of the camera or which drives a platform carrying the article to adjust spacing of the article from the camera. The focusing motor is controlled by the machine vision processor in accordance with a focus index value, typically obtained by the summing the intensity gradients of each of a plurality of small areas (pixels) comprising the entire image of the article. This approach generally yields relatively poor sensitivity because the focus index value is dependent on the complete range of intensity gradients.
Rather than establish the focus index value by summing all the pixel intensity gradients, another technique may be used. Those of the intensity gradients which are above a threshold value can be summed to obtain a measure of the sharpness of focus. This approach requires an a priori knowledge of the intensity gradients within the captured image, which is not often possible.
Thus, there exists a need for an autofocusing technique which is not subject to the foregoing shortcomings.